package tests;

import static org.junit.Assert.*;
import model.User;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
 * This class tests the User class
 * 
 * @author buthainahaldosary
 * @since May 2013
 *
 */


public class TestUser {
	User user;

	/**
	 * This method is called before every test case.
	 */
@Before
public void setUp()
{
	user=new User("User1");
	
}
/**
 * This method is called after every test case.
 */
@After
public void tearDown()
{
user=null;
System.gc();
}

/**
 * This test case tests the setId method	
 */

	@Test
	public void testSetId() {
		user.setId(1);
		assertEquals(1,user.getId());
	}

	/**
	 * This test case tests the getId method
	 */
	@Test
	public void testGetId() {
		user.setId(2);
		assertEquals(2,user.getId());
	}
	/**
	 * This test case tests the getName method
	 */
	@Test
	public void testGetName() {
		assertEquals("User1",user.getName());
	}
	
/**
 * This test case tests the setName method
 */
	@Test
	public void testSetName() {
		user.setName("User2");
		assertEquals("User2",user.getName());
	}
	/**
	 * This test case tests the setError method
	 */
	@Test
	public void testSetError() {
		user.setError("Error");
		assertEquals("Error",user.getError());
	}
	/**
	 * This test case tests the getError method
	 */
	@Test
	public void testGetError() {
		user.setError("New Error");
		assertEquals("New Error",user.getError());
	}

	/**
	 * This test case tests the toString method
	 */
	@Test
	public void testToString() {
		assertEquals("",user.toString());
	}


}
